<template>
  <div class="boa">
    <Head
      :title="`${$route.query.itemIndex}.${$route.query.title}`"
      style="border-bottom: 2px solid #dad9df"
      id="backstyle"
    >
    </Head>
    <div class="tu">
      <img
        :src="getImgUrl(`${this.$route.query.imgurl}`)"
        alt=""
        class="banner-img"
      />
    </div>
    <!-- 版心区域 -->
    <div class="area-center title-center">
      <div class="top">
        <!-- 文字区域 -->
        <div class="umit m-t-20">
          <div class="bottom">
            <div
              class="xi m-t-07"
              v-for="(item, index) in list"
              :key="index"
              @click="wincoffee(item, index)"
            >
              <div class="yuan">
                {{ index + 1 }}
              </div>
              <div class="zhong">
                {{ item.typeName }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Head from "@/components/public/HeadPage.vue";
import { Bannercoffee, getCoffDetailList } from "@/api/index";
export default {
  data() {
    return {
      list: [],
      bannercoffee: "",
      title: sessionStorage.getItem("W-C-title"),
      // num: sessionStorage.getItem("i")
    };
  },
  methods: {
    wincoffee(item, index) {
      let data = {
        superior_index: this.$route.query.itemIndex,
        superior_title: this.$route.query.title,
        superior_id: this.$route.query.id,
        title: item.typeName,
        titleIndex: index + 1,
        id: item.typeId,
      };
      //判断产品选择
      if (
        this.$route.query.id == "ede4f7b1-ec44-4fa2-9f95-e8d0067c7b57" &&
        // item.typeId == '12312312412'
        item.typeId == "6b058e63-af58-4d19-b6b0-659e230aec4d"
      ) {
        this.$router.push({
          path: "/wincoffee/wincoffeetwo",
          query: data,
        });
      }
      //判断定制选择
      else if (
        this.$route.query.id == "ede4f7b1-ec44-4fa2-9f95-e8d0067c7b57" &&
        // item.typeId == '12312312412'
        item.typeId == "81b489fb-a76d-4162-9cfa-393a079daead"
      ) {
        this.$router.push({
          path: "/wincoffee/tasting",
          query: data,
        });
      } else {
        this.$router.push({
          path: "/wincoffee/wincoffeethree",
          query: data,
        });
      }
    },
    getImgUrl(img) {
      return this.montageImgUrl(img);
    },
  },
  components: {
    Head,
  },
  mounted() {
    //轮播图片
    Bannercoffee().then((res) => {
      if (res.data.code == 200) {
        this.bannercoffee = res.data.rows;
        // console.log(res.data.rows);
      }
    });
    getCoffDetailList({
      // typeId: this.$route.query.id
      coffeeId: this.$route.query.id,
    }).then((res) => {
      if (res.data.code == 200) {
        this.list = res.data.data;
      }
    });
  },
};
</script>

<style scoped>
.boa {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 总区域 */
.top {
  width: 100%;
  background-color: white;
}
.tu {
  width: 100%;
  height: 1.68rem;
  display: flex;
  justify-content: center;
}
.banner-img {
  height: 1.68rem;
  width: 4.14rem;
  overflow-x: hidden;
}

.van-swipe-item {
  height: 1.5rem;
}

/* 轮播区域 */
.banner {
  width: 100%;
  height: 1.5rem;
}
/* 版心区域 */

/* 用人单位区域 */
.umit {
  width: 100%;
  min-height: 0.4rem;
  border-radius: 0.1rem;
  background-color: white;
}
.xiao {
  width: 100%;
  display: flex;
  background-color: #f0eff5;
}

/* 左边区域 */
.xiao .left {
  width: 5%;
  height: 0.3rem;
  margin-left: 0.1rem;
  font-weight: 700;
  text-align: center;
  line-height: 0.3rem;
}
.xi {
  width: 100%;
  display: flex;
}
.xi .yuan {
  width: 0.16rem;
  height: 0.16rem;
  margin-left: 0.1rem;
  text-align: center;
  line-height: 0.16rem;
  border-radius: 50%;
  margin-top: 0.05rem;
  border: 1px solid black;
}

/* 中间区域 */
.zhong {
  width: 95%;
  height: 100%;
  line-height: 0.3rem;
  padding-left: 0.05rem;
}
/* 底部区域 */
.bottom {
  width: 100%;
  height: 100%;
}

.zhon {
  width: 90%;
  height: 100%;
  line-height: 0.3rem;
  padding-left: 0.35rem;
}
</style>